(1) Field of the Invention
The present invention relates to an intra-picture prediction coding method, an intra-picture prediction coding apparatus and a program, for determining an intra-picture prediction mode and performing intra-picture prediction coding based on the determined prediction mode.
(2) Description of the Related Art
A product that performs picture coding such as a cell phone and a DVD recorder, in general, incorporates an apparatus for realizing picture coding by predicting pixels in a block per pixel block of m×n pixels (m and n are positive integers), then, coding the information related to the prediction method, and further coding difference information that is a difference image between a predictive image and an original image using a Discrete Cosine Transform (DCT) or the like. A picture coding apparatus usually includes an intra-picture prediction coding apparatus. Intra-picture prediction means to predict a predictive image for a prediction unit block of m×n pixels to be coded (to be referred to as “current block” hereinafter) using already-coded decoded pixels in a picture that includes a current block. The moving picture coding method such as MPEG-4 AVC provides plural number of prediction modes to be used for intra-picture prediction. In the intra-picture prediction coding, picture coding is realized by generating a predictive image for a prediction unit block of m×n pixels (m and n are positive integers) using a single intra-picture prediction mode, and coding a difference image between the predictive image and an input image as well as the information indicating the intra-picture prediction mode used for the generation of the predictive image. In the intra-picture prediction according to the MPEG-4 AVC, spatial prediction is performed using already-coded decoded pixels in the periphery of the current block so as to generate a predictive image for the current block.
Here is a brief but detailed description of intra-picture prediction modes. For example, the MPEG-4 AVC provides nine kinds of intra-prediction modes for luminous pixels in a 4×4 pixel block (see DRAFT ISO/IEC, 14496-10: 2002 (E), “Draft ITU-T Recommendation and Final Draft International Standard of Joint Video Specification”, 2003.5.27, p. 97-102). In a DC prediction mode (prediction mode 2), as shown in FIG. 1C, predictive pixels for a current block of 4×4 pixels are generated by assigning an average value of the eight neighboring decoded pixels on left and above the current block to all the pixel values in the current block. In a horizontal direction prediction mode (prediction mode 1), as shown in FIG. 1B, predictive pixels of a current block of 4×4 pixels are generated based on the decoded pixels of four neighboring pixels on the left of the current block. In a vertical direction prediction mode (prediction mode 0), as shown in FIG. 1A, predictive pixels of a current block of 4×4 pixels are generated using the decoded pixels of four neighboring pixels above the current block. Besides, there are also the prediction modes of different directions: in direction from upper right to lower left (prediction modes 3 and 7) as shown in FIGS. 1D and 1H; in direction from upper left to lower right (prediction modes 4, 5, and 6) as shown in FIGS. 1E, 1F and 1G; in direction from lower left to upper right (prediction mode 8) as shown in FIG. 11. Namely, a total of nine intra-picture prediction modes including eight prediction modes in eight directions and the DC prediction mode as described above are available.
The MPEG-4 AVC provides four intra-picture prediction modes to be used for luminous pixels in a 16×16 pixel block.
In a vertical direction prediction mode (prediction mode 0), as shown in FIG. 2A, predictive pixels of a current block of 16×16 pixels are generated using the decoded pixels of sixteen neighboring pixels above the current block. In a horizontal direction prediction mode (prediction mode 1), as shown in FIG. 2B, predictive pixels of ga current block of 16×16 pixels are generated based on the decoded pixels of sixteen neighboring pixels on the left of the current block. In a DC prediction mode (prediction mode 2), as shown in FIG. 2C, predictive pixels of a current block of 16×16 pixels are generated by assigning an average value of thirty-two neighboring decoded pixels on left and above the current block to all the pixel values in the current block. In a planar prediction mode (prediction mode 3), as shown in FIG. 2D, predictive pixels of a current block of 16×16 pixels are generated based on the decoded pixels of thirty-two neighboring pixels on left and above the current block.
FIG. 3 is a block diagram showing the structure of the conventional intra-picture prediction coding apparatus 100. As shown in FIG. 3, the intra-picture prediction coding apparatus 100 is comprised of the following: an intra-picture prediction execution unit 101 that receives, as an input, an intra-picture prediction reference pixel group 162 that consists of coded pixels in a picture, that is, the pixels to be used for intra-picture prediction, and outputs an intra-picture predictive image 164 and an intra-picture prediction mode information 163; a prediction difference calculation unit 152 that receives, as inputs, an input image 161, the intra-picture predictive image 164 and the intra-picture prediction mode information 163, and outputs a prediction difference image 165; a coding efficiency evaluation unit 153 that receives, as an input, the prediction difference image 165, and outputs an evaluation value 166; an intra-picture prediction mode determination unit 154 that receives, as inputs, the intra-picture prediction mode information 163, the prediction difference image 165 and the evaluation value 166, and outputs a prediction difference image 168 and an intra-picture prediction mode information 167; and a coding unit 155 that receives, as inputs, the intra-picture prediction mode information 167 and the prediction difference image 168, and outputs a coded image 169.
The intra-picture prediction execution unit 101 performs intra-picture prediction on a predictive unit block of m×n pixels (m, n are positive integers) to be processed (to be referred to as “current block” hereinafter), using, one by one, each of the intra-picture prediction modes. That is to say that the intra-picture prediction execution unit 101 predicts the pixels of the current block based on the intra-picture prediction reference pixel group 162, and outputs the result as an intra-picture predictive image 164. The intra-picture prediction execution unit 101 also outputs, as the intra-picture prediction mode information 163, the information related to the prediction mode used for the generation of the intra-picture predictive image 164.
The prediction difference calculation unit 152 calculates a difference value per pixel between the intra-picture predictive image 164, which is predictively generated for the current block by the intra-picture prediction execution unit 101, and the image of the current block in the input image 161, and then, outputs the result as the prediction difference image 165.
The coding efficiency evaluation unit 153 calculates values, each of which indicates coding efficiency, based on the prediction difference image 165. For example, the coding efficiency evaluation unit 153 calculates a sum of absolute values of each of the pixel values in the prediction difference image 165, and outputs the result as the evaluation value 166. It should be noted that the coding efficiency evaluation unit 153 may calculate the evaluation value 166 with reference to the information other than the prediction difference image 165, e.g., the intra-picture prediction mode information based on the coded data of the neighboring coded blocks. In the case where the coding unit 155 employs the method of coding the difference between the intra-picture prediction mode of the neighboring coded block and the mode of the current block, it is possible to calculate the evaluation value 166 by further referring to the intra-picture prediction mode of the neighboring coded block.
The intra-picture prediction mode determination unit 154 outputs, as the intra-picture prediction mode information 167, the intra-picture prediction mode whose evaluation value 166 outputted by the coding efficiency evaluation unit 153 is the smallest among the intra-picture prediction modes sequentially attempted at certain intervals by the intra-picture prediction execution unit 101., The intra-picture prediction mode determination unit 154 also outputs, as the prediction difference image 168, the prediction difference calculated by using the intra-picture prediction mode based on which the smallest evaluation value 166 is obtained.
The coding unit 155 codes the prediction difference image 168 that is a result of the prediction using the determined intra-picture prediction mode, then, codes the intra-picture prediction mode information 167, and outputs the coded image 169.
FIG. 4 is a block diagram showing the structure of the intra-picture prediction execution unit 101. As shown in FIG. 4, the intra-picture prediction execution unit 101 includes a counter 102, an intra-picture prediction mode switching unit 252 and an intra-picture prediction unit 251, and sequentially executes intra-picture prediction at certain intervals using each of the intra-picture prediction modes. The counter 102 sequentially outputs, at certain intervals, the intra-picture prediction mode information 163 that specifies the intra-picture prediction mode to be executed. In this case, integer values ranged from “0” to “8” for uniquely specifying an intra-picture prediction mode are used as intra-picture prediction mode information. Therefore, the values from “0” to “8” are respectively outputted as the value of the intra-picture prediction mode information 163 by counting up the values. However, the count-up operation is executed only for one time after a prediction completion signal 256 changes from “0” to “1”. The intra-picture prediction mode switching unit 252 instructs the intra-picture prediction unit 251 to switch the intra-picture prediction mode according to the value of the intra-picture prediction mode information 163. The intra-picture prediction unit 251 generates the intra-picture predictive image 164 for the current block using the intra-picture prediction reference image group 162, based on the intra-picture prediction mode instructed by the intra-picture prediction mode switching unit 252, and outputs it. The intra-picture prediction unit 251 also outputs the value “1” as the prediction completion signal 256, each time the generation of the intra-picture predictive image 164 based on one intra-picture prediction mode is completed.
FIG. 5 is a block diagram showing the structure of the prediction difference calculation unit 152. As shown in FIG. 5, the prediction difference calculation unit 152 includes a subtraction circuit 261, and outputs a difference image between the input image and the intra-picture predictive image. The subtraction circuit 261 calculates the difference between the input image 161 inputted and the intra-picture predictive image 164, and outputs the result of the calculation as the prediction difference image 165. That is to say, the subtraction circuit 261 outputs the prediction difference image 165 holding pixel values. Each of the pixel values indicates a difference between each of the pixel values in the intra-picture predictive image 164 and each of the corresponding pixel values in the input image 161.
FIG. 6 is a block diagram showing the structure of the coding efficiency evaluation unit 153. As shown in FIG. 6A, the coding efficiency evaluation unit 153 includes a multiplexer 271, a comparator 272, a switch 273, an adder 274 and a register 275, and outputs an evaluation value indicating coding efficiency based on the prediction difference image. The evaluation value 166 is a sum of absolute values of each of the pixels in the prediction difference image 165. The prediction difference image 165 is a value of each of the pixels sequentially outputted at certain intervals from the prediction difference calculation unit 152. The comparator 272 compares the prediction difference image 165 and a value “0”, and an output 284 from the comparator 272 holds a value “1” in the case where the pixel value in the prediction difference image 165 indicates “0” or smaller, and holds the value “0” in the case where the pixel value in the prediction difference image 165 indicates a value greater than “0”. The switch 273, as shown in FIG. 6B, switches between a value “a” and a value “b” which are inputted based on an inputted value “x”, and outputs it as an output value “c”. In this case, the output 284 from the comparator 272 controls the switch 273 while an output 280 from the switch 273 holds a value “−1” in the case where the output 284 of the comparator 272 indicates “1”, and holds a value “1” in the case where the output 284 from the comparator 272 indicates “0”. The multiplexer 271 multiplexes the prediction difference image 165 by the output 280 from the switch 273: As a result, an output 285 from the multiplexer 271 indicates a value equivalent to the absolute value of the prediction difference image 165. The adder 274 adds the output 285 from the multiplexer 271 and an output 282 from a delay device 275. While the first pixel in the unit block is processed, the output 282 from the delay device 275 is controlled to be “0” (not shown in the diagram). When the adder 274 processes the data, which is obtained by processing the first pixel in the prediction difference image 165, the evaluation value 166 holds, as an output, the absolute value of the first pixel in the prediction difference image 165. The delay device 275 delays the operation by one pixel. When the adder 274 processes the data obtained by processing the nth pixel in the prediction difference image 165, the evaluation value 166 indicates a value equivalent to a sum of absolute values for the pixel values of the first to the (n−1)th pixels in the prediction difference image 165. Therefore, the value of an output 281 from the adder 274 equals to a sum of the absolute values for the pixel values of the first to the n th pixels in the prediction difference image 165. Through the above processing, the sum of the absolute values for the prediction difference image 165 is eventually outputted as the evaluation value 166.
FIG. 7 is a block diagram showing the structure of the intra-picture prediction mode determination unit 154. As shown in FIG. 7, the intra-picture prediction mode determination unit 154 includes a prediction difference image storage memory 291, a comparator 292, a NOT circuit 293, and registers 294, 295. The intra-picture prediction mode determination unit 154 outputs the intra-picture prediction mode whose evaluation value is the smallest and the prediction difference image predicted using the intra-picture prediction mode based on which the smallest evaluation value is obtained. The evaluation value 166 and read data 302 are inputted to the comparator 292. The evaluation value 166 is written in the register 294 only when a write enable signal 301 indicates a value “1” while the value written in the register 294 is outputted to the read data 302 regardless of the value held by the write enable signal 301. In the register 294, a value greater than a maximum value that can be obtained as the evaluation value 166 is written beforehand as an initial state. The prediction mode information related to the intra-picture prediction mode to be attempted is sequentially inputted at certain intervals into the intra-picture prediction mode information 163, while the evaluation value resulted from the prediction based on each intra-picture prediction mode information 163 is sequentially inputted in the evaluation value 166 at certain intervals. In the case where the first evaluation value among the evaluation values thus sequentially inputted at certain intervals is given to the evaluation value 166, an output 303 from the comparator 292 indicates a value “0” since the evaluation value 166 indicates a value smaller than the value indicated in the read data 302, and the NOT circuit 293 sets the write enable signal 301 to “1”. In the case where the write enable signal 301 indicates a value “1”, the prediction difference image 165, which is the result of the prediction based on the intra-picture prediction mode information 163 at that time, is stored in the prediction difference image storage memory 291, and the value of the intra-picture prediction mode information 163 is written in the register 295. In the case where the k th evaluation value among the evaluation values sequentially inputted at certain intervals is given to the evaluation value 166, the smallest evaluation value among the first to the (k-1)th evaluation values sequentially inputted at certain intervals is outputted as the read data 302. The comparator 292 compares the read data 302 thus outputted and the k th evaluation value 166. In the case where the k th evaluation value 166 is smaller than the value indicated in the read data 302, the output 303 from the comparator 292 indicates a value “0”. Here, the NOT circuit 293 sets the value of the write enable signal 301 to “1”. In the case where the value of the write enable signal 301 indicates “1”, the prediction difference image 165 resulted from the prediction based on the intra-picture prediction mode information 163 used at that time is stored into the prediction difference image storage memory 291, while the value of the intra-picture prediction mode information 163 is written in the register 295. In the case where the k th evaluation value 166 is equal to or greater than the value indicated in the read data 302, the output 303 from the comparator 292 indicates a value “1”. Here, the NOT circuit 293 sets the value of the write enable signal 301 to “0”, and new data is stored neither in the prediction difference image storage memory 291 nor in the register 295. Thus, the intra-picture prediction mode information corresponding to the intra-picture prediction mode whose evaluation value is the smallest, as a result of the processing related to the evaluation value 166 for all the intra-picture prediction modes attempted for the current block, is stored in the register 295, and then outputted as the intra-picture prediction mode information 167. The prediction difference image corresponding to the intra-picture prediction mode, based on which the smallest evaluation value is obtained, is stored in the prediction difference image storage memory 291, and the image data is outputted as the prediction difference image 168.
The coding unit 155 codes the intra-picture prediction mode information 167 and prediction difference image 168 which are inputted, and outputs the coded image 169. In the coding performed on the prediction difference image 168, quantization is performed after frequency transformation such as a DCT, and then, the quantized values are coded using variable length coding or arithmetic coding. As for the intra-picture prediction mode information 167, variable length coding or arithmetic coding is used.
FIG. 8 is a flowchart for explaining the intra-picture prediction coding method used by the intra-picture prediction coding apparatus 100. However, the chart shows the processing that is performed per prediction unit block.
A value greater than a maximum value that can be obtained as the evaluation value 166 is substituted beforehand in a variable “min_cost” (Step S11). Then, intra-picture prediction is performed sequentially starting from the intra-picture prediction mode whose “mode” indicates “0” (Step S12), regarding the intra-picture prediction mode information 163 as a “mode”, and “predImg(mode)” that represents the intra-picture predictive image 164 is generated (Step S13). Next, “diffImg(mode)” that represents the prediction difference image 165 between the generated intra-picture predictive image “predImg(mode)” and the input image 161 is generated (Step S14). After that, “cost(mode)” that represents the evaluation value 166 obtained using the intra-picture prediction mode is then calculated based on the prediction difference image “diffImg(mode)” (Step S15). The “cost(mode)” resulted from the calculation is compared with a value “min_cost(mode)” (Step S16). In the case where the evaluation value “cost(mode)” is smaller (Yes in Step S16), the evaluation value “cost(mode)” is stored in the variable “min_cost” (Step S17), the prediction mode information “mode” is stored in a variable “best_mode” (Step S18), and the prediction difference image “difflmg(mode)” is stored in a variable “best_diffImg” (Step S19). A sequence of processing (Steps S13-S19) for generating the intra-picture predictive image “diffImg(mode)” is respectively performed for the modes from “0” to “8” (Step S12). Eventually, the “best_mode”, which is the intra-picture prediction mode information 167 obtained by using the intra-picture prediction mode whose evaluation value 166 is the smallest, and the difference image between the image predicted based on the above-mentioned intra-picture prediction mode and the input image 161, namely, “best_diffImg” representing the prediction difference image 168, are coded, and the coded image 169 is generated (Step S20).
With the intra-picture prediction coding apparatus as described above, the cost of hardware or the amount of processing operated by software can be reduced, and in image quality can be improved due to enhancement of predictability.